package com.aaa.cofig;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;

@Configuration
public class SwaggerConfig {

    @Bean
    public Docket docket() {
        Docket docket = new Docket(DocumentationType.SWAGGER_2)
                .groupName("qy173")//设置组名
                .apiInfo(apiInfo()) //文档信息介绍
                .select().apis(RequestHandlerSelectors.basePackage("com.aaa.controller"))//为哪个bao生成接口文档
                .build();
        return docket;
    }

    private ApiInfo apiInfo() {
        Contact DEFAULT_CONTACT = new Contact("JOJO", "http://www.jd.com", "110@qq.com");
        ApiInfo info = new ApiInfo("测试swagger文档", "测试swagger文档", "2.0", "http://www.baidu.com", DEFAULT_CONTACT, "AAA集团", "http://www.aaa.comm", new ArrayList<VendorExtension>());
        return info;
    }
}